<?php
$table='shai_comment';
$page = !($_GET['page'])?'1':intval($_GET['page']);
$page2=($page-1)*10;
$pagesize=10;

$kword=$_GET['kword'];
$shai_id=$_GET['shai_id'];

if($shai_id==0){
    $where_shai_id='1=1';
}
else{
    $where_shai_id="shai_id = '{$shai_id}'";
}

if($kword==''){
    $where_kword='1=1';
}
else{
    $where_kword="$se like '%{$kword}%'";
}

$sql="select count(*) as totalnum from ".$BIAOTOU.$table." where $where_kword and $where_shai_id  order by id desc";
$rsnum = mysql_query($sql);
$rownum = mysql_fetch_array($rsnum);
$total=$rownum["totalnum"];

$sql="select * from ".$BIAOTOU.$table." where $where_kword and $where_shai_id order by id desc limit $page2,$pagesize";
$rs = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" contect="no-cache"> 
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link media="screen" rel="stylesheet" href="../../css/colorbox.css" />
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
-->
</style>
<script>
//全选/取消
function checkAll(o,checkBoxName){
	var oc = document.getElementsByName(checkBoxName);
	for(var i=0; i<oc.length; i++) {
		if(o.checked){
			oc[i].checked=true;	
		}else{
			oc[i].checked=false;	
		}
	}
}
</script>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="text-align:center">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td width="258" height="30" align="left" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 内容管理 </strong></td>
              
              <td width="579" align="left" bgcolor="E9F2FB" class="bigtext">
              <form id="form1" name="form1" method="get" action="">
              <input type="hidden" name="act" value="list" />
              <select name="se"><option value="ddusername">会员名</option></select>：<input type="text" name="kword" value=""  />
                <input type="submit" value="查找" />
                </form>
                </td>
              <td width="130" height="30" align="right" bgcolor="E9F2FB" class="bigtext">共有 <b><?php echo $total;?></b> 条记录&nbsp;&nbsp;</td>
            </tr>
            <tr>
              <td colspan="3" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><table width="100%" border=1 cellpadding=0 cellspacing=0
style="border-collapse: collapse" bordercolor="#dddddd">
                    <tr>
                      <td width="4%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;<input type="checkbox" onClick="checkAll(this,'ids[]')" /></strong></td>
                      <td width="" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;评论</strong></td>
                      <td width="6%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;查看商品</strong></td>
                      <td width="8%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;会员</strong></td>
                      <td width="11%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;时间</strong></td>
                    </tr>
                    <form action="">
                    <?php
					while ($row = mysql_fetch_array($rs))
					{
						echo "<tr>";
						echo "<td height=30 class=bigtext>&nbsp;<input type='checkbox' name='ids[]' value='".$row["id"]."' id='content_".$row["id"]."' /></td>";
                        echo "<td height=30 class=bigtext align=left>&nbsp;".str_replace('src="emoticons','src="../../emoticons',$row["comment"])."</td>";
						echo "<td height=30 class=bigtext>&nbsp;<a href='admin.php?act=addedi&id=".$row["shai_id"]."'>查看</a></td>";
						echo "<td height=30 class=bigtext>&nbsp;".$row["ddusername"]."</td>";
                      	echo "<td class=bigtext align=center>&nbsp;".date('Y-m-d H:i:s',$row["time"])."</td>";	
						echo "</tr>";
					}
					?>
                    <input type="hidden" name="act" value="del" />
                    <input type="hidden" name="table" value="shai_comment" />
                    <tr>
                      <td height="43" colspan="11" align="center">
                      <div class="yahoo2" id="pages" style=" position:relative; height:30px">
                      <div style="position:absolute; left:px; top:5px"><input type="submit" value="删除" onclick='return confirm("确定要删除?")'/></div>
					    <?php  pageft($total,$pagesize,1,1,0,10,"admin.php?act=comment_list&kword=".$kword.'&catid='.$catid);echo $pagenav;?>
                      </div></td>
                    </tr>
                    </form>
                  </table></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>